package com.PAT.UnSatisfying;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/11/29/18:04
 * @Description:
 *     // 打印规律,5 3 1 3 5 除去1 其它是对称的 1+2*n ------*2 ---    2+4*n
 *     // 1 7 17 31    ---1+6+10+14+18+22    每次加4   N-1
 *                      // 6 16 30 48 70    n6+n(n-1)4/2
 * @Target: 18,差2
 */
public class 打印沙漏 {


    // 总共:s  = na + n(n-1)*d/2  单层 1+2*n


    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int sum  = in.nextInt();
        String ss = in.next();
        int countSum  = sum-1;
        int n = 0;  // 层数
        n = (int)Math.sqrt(sum/2+1)-1;

        // 多余的
        int TheRest = 0;
        TheRest = sum-1 - (4*n+2*n*n);

//        System.out.println("层数:"+(2*n+1));


        PrintByN(n,ss);
        System.out.println(TheRest);

    }

    public static void PrintByN(int n,String ss){
        int print = 2*n+1; // 打印次数
        int max = 2*n+1;
        int mid = print/2;
        int i = 0;


            while (print>0){
                if (i<mid){
                  for (int j = 0; j < max; j++) {
                      if ((j<i||j>max-i-1)&&j<max/2){
                          System.out.print(" ");
                      }else if (j>=i&&j<=max-i-1){
                        System.out.print(ss);
                      }
                  }
                    System.out.println();
                  i++;
                }else if (i==mid){
                    for (int j = 0; j < max; j++) {
                        if((j!=(1+2*n)/2)&&j<max/2){
                            System.out.print(" ");
                        }else if (j==(1+2*n)/2){
                            System.out.print(ss);
                        }
                    }
                    System.out.println();
                    i++;
                }else if(i>mid){
                    int d = max-i-1;
                    for (int j = 0; j < max; j++) {
                        if ((j<d||j>max-d-1)&&j<max/2){
                            System.out.print(" ");
                        }else if (j>=d&&j<=max-d-1){
                            System.out.print(ss);
                        }

                    }
                    System.out.println();
                    i++;
                }

                print--;
            }



    }

}
